package com.tsing.common.Demo;

import com.tsing.common.config.ParentJob;
import com.tsing.common.contants.QuartzConstant;
import org.quartz.JobExecutionContext;

import javax.annotation.PostConstruct;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

//@Component("DemoJob")
public class TestJob extends ParentJob {

    @PostConstruct
    public void init() {
        this.cronExpression = QuartzConstant.ONE_SECOND;
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) {
        try {
            System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()));
        } catch (Exception e) {
            System.out.println("自行抛出异常");
        }
    }

}
